package com.sls.web.manager.action.ekhui;

import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.sls.web.manager.action.SuperAction;
import com.sls.web.manager.common.Constants;
import com.sls.web.manager.common.DateUtil;
import com.sls.web.manager.game.client.DepositClient;
import com.sls.web.manager.game.client.FundBalanceClient;
import com.sls.web.manager.game.client.PaymentClient;
import com.sls.web.manager.game.pojo.ekhui.FundBalance;
import com.sls.web.manager.game.querybean.ekhui.FundBalanceQuery;
import com.sls.web.manager.page.Pagination;
import com.sls.web.manager.pojo.UserInfoVO;

public class FundBalanceAction extends SuperAction{
	private Logger log = LoggerFactory.getLogger(FundBalanceAction.class) ;
	private List<FundBalance> fundBalanceList  ;
	private Pagination<FundBalance> page;
	private FundBalance fundBalance ;
	private FundBalanceQuery fundBalanceQuery ;
	protected String startTime ;
	protected String endTime ;
	protected int recordCount ;
	public String list(){
		UserInfoVO userInfoVO = getCurrentOperator() ;
		FundBalanceClient client = FundBalanceClient.getInstance() ;
		if(fundBalance == null){
			fundBalance = new FundBalance() ;
		}
		if (fundBalanceQuery == null) {
			fundBalanceQuery = new FundBalanceQuery();
			fundBalanceQuery.setPageSize(Constants.INIT_PAGESIZE);
			fundBalanceQuery.setCurrentPage(Constants.INIT_CURRENTPAGE);
		}
		recordCount = client.getFundBalanceCount(fundBalance, userInfoVO, getStartTime(),
				getEndTime()) ;
		if(page == null){
			page = new Pagination<FundBalance>(fundBalanceQuery.getCurrentPage() , recordCount , fundBalanceQuery.getPageSize()) ;
		}
		fundBalanceList = client.getFundBalanceList(fundBalance, userInfoVO, getStartTime(),getEndTime(), 
				fundBalanceQuery.getCurrentPage(), fundBalanceQuery.getPageSize()) ;
		
		page.setList(fundBalanceList) ;
		page.setRowCount(recordCount) ;
		return "list" ;
	}
	public String saveFundBalance(){
		UserInfoVO userInfoVO = getCurrentOperator() ;
		
		return "ajax" ;
	}
	public List<FundBalance> getFundBalanceList() {
		return fundBalanceList;
	}
	public void setFundBalanceList(List<FundBalance> fundBalanceList) {
		this.fundBalanceList = fundBalanceList;
	}
	public Pagination<FundBalance> getPage() {
		return page;
	}
	public void setPage(Pagination<FundBalance> page) {
		this.page = page;
	}
	public FundBalance getFundBalance() {
		return fundBalance;
	}
	public void setFundBalance(FundBalance fundBalance) {
		this.fundBalance = fundBalance;
	}
	public FundBalanceQuery getFundBalanceQuery() {
		return fundBalanceQuery;
	}
	public void setFundBalanceQuery(FundBalanceQuery fundBalanceQuery) {
		this.fundBalanceQuery = fundBalanceQuery;
	}
	public String getStartTime() {
		if(StringUtils.isBlank(startTime)){
			startTime = DateUtil.format(DateUtil.addDays(-1), "yyyy-MM-dd") ;
		}
		return startTime;
	}
	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}
	public String getEndTime() {
		if(StringUtils.isBlank(endTime)){
			endTime = DateUtil.format(DateUtil.addDays(-1), "yyyy-MM-dd") ;
		}
		return endTime;
	}
	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}
	public int getRecordCount() {
		return recordCount;
	}
	public void setRecordCount(int recordCount) {
		this.recordCount = recordCount;
	}
	
	
	
}
